package com.springinaction.knights;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.config.BeanPostProcessor;

public class BraveKnight implements Knight, BeanNameAware, BeanPostProcessor {
    private Quest quest;

    public BraveKnight(Quest quest){
        this.quest = quest;
    }

    public void embarkOnQuest(){
        quest.embark();
    }

    public void setBeanName(String name){
        System.out.println("Bean name=" + name);
    }

    public Object postProcessBeforeInitialization(Object object, String str){
        System.out.println("postProcessBeforeInitialization=" + object + " str=" +str);
        return object;
    }

    public Object postProcessAfterInitialization(Object object, String str){
        System.out.println("postProcessAfterInitialization=" + object + " str=" +str);
        return object;
    }
}
